package cn.com.chengmandian.bike.controller;

import cn.com.chengmandian.agent.utils.AuthUtil;
import cn.com.chengmandian.bike.dto.RemindRuleDto;
import cn.com.chengmandian.bike.model.EbRemindRule;
import cn.com.chengmandian.bike.service.IEbRemindRuleService;
import cn.com.chengmandian.core.db.pojo.PageData;
import cn.com.chengmandian.core.web.pojo.AgentUser;
import cn.com.chengmandian.core.web.pojo.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 电单车运营-会员提醒-提醒规则 前端控制器
 * </p>
 *
 * @author AutoGenerator
 * @since 2024-07-03
 */
@Api(tags = "会员提醒-提醒规则")
@RestController
@RequestMapping("/remind/rule")
public class EbRemindRuleController {

    @Autowired
    private IEbRemindRuleService remindRuleService;

    @ApiOperation("会员提醒-提醒规则-列表（废弃）")
    @PostMapping(value = "/list", name = "会员提醒-提醒规则-列表（废弃）")
    public AjaxResult<List<EbRemindRule>> list(
        @RequestBody RemindRuleDto dto) {
        Assert.notNull(dto.getTypes(), "提醒类型列表不能为空");
        Assert.isTrue(!dto.getTypes().isEmpty(), "提醒类型列表不能为空");
        List<EbRemindRule> rules = remindRuleService.list(dto);
        return AjaxResult.success(rules);
    }


    @ApiOperation("获取会员提醒-提醒规则")
    @GetMapping(value = "/get", name = "获取会员提醒-提醒规则")
    public AjaxResult<List<EbRemindRule>> get(RemindRuleDto dto) {
        Assert.notNull(dto.getTypes(), "提醒类型列表不能为空");
        Assert.isTrue(!dto.getTypes().isEmpty(), "提醒类型列表不能为空");
        List<EbRemindRule> rules = remindRuleService.list(dto);
        return AjaxResult.success(rules);
    }

}
